NL = '0a'x;Title = 'PM5 - Birth check v1.0';call getprefs();call initlibs();dir = Showdir('PM5:data','File','/');call splittoarray(dir,'/');do b = 1 to file;name = files.b;birth = '';getBirth(name);if length(birth) > 0 then call checkbirth(name,birth);end;exit;Initlibs:;a=0;If exists('LIBS:rexxreqtools.library') ~= 1 then do;Say 'Unable to open rexxreqtools.library';a=1;end;If exists('LIBS:reqtools.library') ~= 1 then do;Say 'Unable to open reqtools.library';a=1;end;If exists('LIBS:rexxsupport.library') ~= 1 then do;Say 'Unable to open rexxsupport.library';a=1;end;if a=1 then do;say 'Unable to run:';say Title;say 'Get the libraries listed above, you will need them/it...';exit 20;end;call addlib("rexxsupport.library", 0, -30, 0);call addlib("rexxreqtools.library", 0, -30, 0);Return;splittoarray:;instr = arg(1);splitchar = arg(2);files.='';file = 1;do i = 1 to length(instr);c = substr(instr,i,1,);if c = splitchar then do;file = file + 1;end;else do;files.file = files.file || c;end;end;return 0;checkbirth:
name = arg(1);birth = arg(2);if length(birth)=6 then do;BD = substr(birth,1,2);BM = substr(birth,3,2);BY = 19 || substr(birth,5,2);CD = substr(date(u),4,2);CM = left(date(u),2);CY = right(date(u),2);Birth_forwardAlert = 7;Birth_backwardAlert = 7;if Birth_backwardAlert > 0 then do;if BM = CM then do;if BD < CD & BD > (CD - Birth_backwardAlert - 1) & CY >96 then do;call popstr(name ' is ' Age(Birth) || ' years old now.' || NL || "I hope you didn't miss the party! :-}");end;end;if BM = CM-1 then do;if (CD - Birth_backwardAlert) < 1 & BD > (Birth_backwardAlert - 1) & CY >96 then do;call popstr(name ' is ' Age(Birth) || ' years old now.' || NL || "I hope you didn't miss the party! :-}");end;end;end;if Birth_backwardAlert > 0 | Birth_forwardAlert > 0 then do;if BM = CM then do;if BD = CD & CY>96 then do;call popstr(name " has turned " Age(Birth)+1 ' years today.' NL "Happy Birthday to " name " from PM5!!! :-D");end;end;end;if Birth_forwardAlert > 0 then do;if BM = CM then do
if BD > CD & BD < (CD + Birth_forwardAlert + 1) & CY>96 then do;call popstr(name " is turning " Age(Birth)+1 ' years soon.' NL "Don't forget it... :-)");end;end;if BM = CM+1 then do;if CD + Birth_forwardAlert > 31 & BD < (Birth_forwardAlert + 1) & CY>96 then do;call popstr(name " is turning " Age(Birth)+1 ' years soon.' NL "Don't forget it... :-)");end;end;end;return 0;POPstr:;Parse arg STR, Tit;if length(Tit) = 0 then do;ShowTitle = Title;end;else do;ShowTitle = Tit;end;if length(str) = 0 then str = 'An unknown error occured...';Call RTezrequest(STR,'_PM5|_Close',ShowTitle, fonttag "rt_reqpos = reqpos_centerscr");if rtresult = 1 then address command "run >NIL: C:PM5 *SkipBirth " name;return 0;AGE:;CPR = arg(1);BD = left(CPR,2);BM = substr(CPR,3,2);BY = Right(CPR,2);CD = substr(date(u),4,2);CM = left(date(u),2);CY = right(date(u),2);Y = CY-BY;select;when cm < bm then do;Y=Y-1;end;when CM = BM then do;if CD < BD then do;Y=Y-1;end;end;otherwise NOP;end;return Y;GetPrefs:;if exists('PM5:PM5.Prefs') then do
success = open(FILE,'PM5:PM5.Prefs','r');ID = readln(FILE);if ID = 'PMCFG1' then do;FONT = readln(FILE);end;else do;FONT = 'Xhelvetica.font/11';end;end;else do;FONT = 'Xhelvetica.font/11';end;Call Close(FILE);Fonttag = "rt_font=" || Font;return 0;getBirth:;filename = arg(1);call open(Fil,"PM5:Data/" || filename,'R');skip = 0;do while EOF(Fil) = 0 & skip = 0;line = readln(fil);if line = '#D' | line = '#d' then do;Birth = readln(fil);skip = 1;end;end;Call Close(Fil);return 0